Advanced Lane Finding Project

The goals / steps of this project are the following:

  • Compute the camera calibration matrix and distortion coefficients given a set of chessboard images.
  • Apply a distortion correction to raw images.
  • Use color transforms, gradients, etc., to create a thresholded binary image.
  • Apply a perspective transform to rectify binary image ("birds-eye view").
  • Detect lane pixels and fit to find the lane boundary.
  • Determine the curvature of the lane and vehicle position with respect to center.
  • Warp the detected lane boundaries back onto the original image.
  • Output visual display of the lane boundaries and numerical estimation of lane curvature and vehicle position.

First, I'll compute the camera calibration using chessboard images

In [1]:
import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
%matplotlib inline

# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
objp = np.zeros((6*9,3), np.float32)
objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,2)

# Arrays to store object points and image points from all the images.
objpoints = [] # 3d points in real world space
imgpoints = [] # 2d points in image plane.

# Make a list of calibration images
images = glob.glob('camera_cal/calibration*.jpg')
images_tbc = []

# Step through the list and search for chessboard corners
for fname in images:
    img = cv2.imread(fname)
    gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

    # Find the chessboard corners
    ret, corners = cv2.findChessboardCorners(gray, (9,6),None)

    # If found, add object points, image points
    if ret == True:
        objpoints.append(objp)
        imgpoints.append(corners)

        # Draw and display the corners
        img = cv2.drawChessboardCorners(img, (9,6), corners, ret)
        plt.figure()
        plt.imshow(img)
        plt.title(fname)
    else:
        print(fname+": corners not found")
        images_tbc.append(fname)

ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, (img.shape[1],img.shape[0]), None, None)
camera_cal/calibration1.jpg: corners not found
camera_cal/calibration4.jpg: corners not found
camera_cal/calibration5.jpg: corners not found

Apply a distortion correction to raw images

In [116]:
for fname in images_tbc:
    # Read in an image
    img = cv2.imread(fname)
    undistorted = cv2.undistort(img, mtx, dist, None, mtx)
    plt.figure(figsize=(20,10))
    plt.subplot(1,2,1)
    plt.imshow(img)
    plt.title(fname)
    plt.subplot(1,2,2)
    plt.imshow(undistorted)
    plt.title(fname + " undistorted")
In [803]:
import matplotlib.image as mpimg

image = mpimg.imread('test_images/test5.jpg')
# Run the function
undist = cv2.undistort(image, mtx, dist, None, mtx)# Plot the result
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image)
ax1.set_title('Original Image', fontsize=50)
ax2.imshow(undist)
ax2.set_title('Undistorted Image', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

Define gradient and color transforms to help detect lane lines

Sobel threshhold on x and y direction

In [2]:
# Define a function that applies Sobel x or y, 
# then takes an absolute value and applies a threshold.
# Note: calling your function with orient='x', thresh_min=5, thresh_max=100
# should produce output like the example image shown above this quiz.
def abs_sobel_thresh(img, orient='x', sobel_kernel = 3, thresh=(0,255)):
    
    # Apply the following steps to img
    # 1) Convert to grayscale
    # 2) Take the derivative in x or y given orient = 'x' or 'y'
    # 3) Take the absolute value of the derivative or gradient
    # 4) Scale to 8-bit (0 - 255) then convert to type = np.uint8
    # 5) Create a mask of 1's where the scaled gradient magnitude 
            # is > thresh_min and < thresh_max
    # 6) Return this mask as your binary_output image
    # Convert to HLS and pick the S channel
    hls = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
    s_channel = hls[:,:,2]
    # Apply x or y gradient with the OpenCV Sobel() function
    # and take the absolute value
    if orient == 'x':
        abs_sobel = np.absolute(cv2.Sobel(s_channel, cv2.CV_64F, 1, 0, ksize = sobel_kernel))
    if orient == 'y':
        abs_sobel = np.absolute(cv2.Sobel(s_channel, cv2.CV_64F, 0, 1, ksize = sobel_kernel))
    # Rescale back to 8 bit integer
    scaled_sobel = np.uint8(255*abs_sobel/np.max(abs_sobel))
    # Create a copy and apply the threshold
    binary_output = np.zeros_like(scaled_sobel)
    # Here I'm using inclusive (>=, <=) thresholds, but exclusive is ok too
    binary_output[(scaled_sobel >= thresh[0]) & (scaled_sobel <= thresh[1])] = 1
    return binary_output

Sobel magnitube

In [3]:
# Define a function that applies Sobel x and y, 
# then computes the magnitude of the gradient
# and applies a threshold
def mag_thresh(img, sobel_kernel=3, mag_thresh=(0, 255)):
    
    # Apply the following steps to img
    # 1) Convert to grayscale
    # 2) Take the gradient in x and y separately
    # 3) Calculate the magnitude 
    # 4) Scale to 8-bit (0 - 255) and convert to type = np.uint8
    # 5) Create a binary mask where mag thresholds are met
    # 6) Return this mask as your binary_output image
    # Convert to HLS and pick the S channel
    hls = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
    s_channel = hls[:,:,2]
    # Take both Sobel x and y gradients
    sobelx = cv2.Sobel(s_channel, cv2.CV_64F, 1, 0, ksize=sobel_kernel)
    sobely = cv2.Sobel(s_channel, cv2.CV_64F, 0, 1, ksize=sobel_kernel)
    # Calculate the gradient magnitude
    gradmag = np.sqrt(sobelx**2 + sobely**2)
    # Rescale to 8 bit
    scale_factor = np.max(gradmag)/255 
    gradmag = (gradmag/scale_factor).astype(np.uint8) 
    # Create a binary image of ones where threshold is met, zeros otherwise
    binary_output = np.zeros_like(gradmag)
    binary_output[(gradmag >= mag_thresh[0]) & (gradmag <= mag_thresh[1])] = 1
    return binary_output

Direction of gradient after applying Sobel x and y

In [4]:
# Define a function that applies Sobel x and y, 
# then computes the direction of the gradient
# and applies a threshold.
def dir_threshold(img, sobel_kernel=3, thresh=(0, np.pi/2)):
    
    # Apply the following steps to img
    # 1) Convert to grayscale
    # 2) Take the gradient in x and y separately
    # 3) Take the absolute value of the x and y gradients
    # 4) Use np.arctan2(abs_sobely, abs_sobelx) to calculate the direction of the gradient 
    # 5) Create a binary mask where direction thresholds are met
    # 6) Return this mask as your binary_output image
    # Convert to HLS and pick the S channel
    hls = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
    s_channel = hls[:,:,2]
    # Calculate the x and y gradients
    sobelx = cv2.Sobel(s_channel, cv2.CV_64F, 1, 0, ksize=sobel_kernel)
    sobely = cv2.Sobel(s_channel, cv2.CV_64F, 0, 1, ksize=sobel_kernel)
    # Take the absolute value of the gradient direction, 
    # apply a threshold, and create a binary image result
    absgraddir = np.arctan2(np.absolute(sobely), np.absolute(sobelx))
    binary_output =  np.zeros_like(absgraddir)
    binary_output[(absgraddir >= thresh[0]) & (absgraddir <= thresh[1])] = 1
    return binary_output

Threshhold only

In [807]:
image = mpimg.imread('test_images/test5.jpg')
# Run the function
grad_binary = abs_sobel_thresh(image, orient='x', sobel_kernel=5, thresh=(20, 100))
# Plot the result
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image)
ax1.set_title('Original Image', fontsize=50)
ax2.imshow(grad_binary, cmap='gray')
ax2.set_title('Thresholded Gradient', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

Threshhold Magnitude

In [808]:
# Run the function
mag_binary = mag_thresh(image, sobel_kernel=5, mag_thresh=(30, 150))
# Plot the result
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image)
ax1.set_title('Original Image', fontsize=50)
ax2.imshow(mag_binary, cmap='gray')
ax2.set_title('Thresholded Magnitude', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

Threshold gradient with direction

In [809]:
# Run the function
dir_binary = dir_threshold(image, sobel_kernel=15, thresh=(0.9, 1.1))
# Plot the result
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image)
ax1.set_title('Original Image', fontsize=50)
ax2.imshow(dir_binary, cmap='gray')
ax2.set_title('Thresholded Grad. Dir.', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

Combined Sobel gradient x and gradient y or magnitude and direction

In [810]:
# Choose a Sobel kernel size

# Apply each of the thresholding functions
gradx = abs_sobel_thresh(image, orient='x', sobel_kernel=5, thresh=(20, 100))
grady = abs_sobel_thresh(image, orient='y', sobel_kernel=5, thresh=(20, 100))
mag_binary = mag_thresh(image, sobel_kernel=5, mag_thresh=(30, 150))
dir_binary = dir_threshold(image, sobel_kernel=15, thresh=(0.9, 1.1))

sb_combined = np.zeros_like(dir_binary)
sb_combined[((gradx == 1) & (grady == 1)) | ((mag_binary == 1) & (dir_binary == 1))] = 1

# Plot the result
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image)
ax1.set_title('Original Image', fontsize=50)
ax2.imshow(sb_combined, cmap='gray')
ax2.set_title('Thresholded Grad. Dir.', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

HLS color space with S and L channel threshold

In [5]:
# Define a function that thresholds the S-channel of HLS
# Use exclusive lower bound (>) and inclusive upper (<=)
def hls_select(img, s_thresh=(0, 255), l_thresh=(30,255)):
    # 1) Convert to HLS color space
    # 2) Apply a threshold to the S channel
    # 3) Return a binary image of threshold result
    hls = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
    s_channel = hls[:,:,2]
    l_channel = hls[:,:,1]
    binary_output = np.zeros_like(s_channel)
    binary_output[(s_channel > s_thresh[0]) & (s_channel <= s_thresh[1]) & (l_channel > l_thresh[0]) & (l_channel <= l_thresh[1])] = 1
    return binary_output
In [812]:
hls_binary = hls_select(image, s_thresh=(120, 255))

# Plot the result
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image)
ax1.set_title('Original Image', fontsize=50)
ax2.imshow(hls_binary, cmap='gray')
ax2.set_title('Thresholded S and L', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

HLS color space threshold + Combined Sobel gradient threshold

In [813]:
# Stack each channel to view their individual contributions in green and blue respectively
# This returns a stack of the two binary images, whose components you can see as different colors
color_binary = np.dstack(( np.zeros_like(hls_binary), hls_binary, sb_combined))

# Combine the two binary thresholds
combined_binary = np.zeros_like(hls_binary)
combined_binary[(hls_binary == 1) | (sb_combined == 1)] = 1

# Plotting thresholded images
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(20,10))
ax1.set_title('Stacked thresholds')
ax1.imshow(color_binary)

ax2.set_title('Combined S and L channel and gradient thresholds')
ax2.imshow(combined_binary, cmap='gray')
Out[813]:
<matplotlib.image.AxesImage at 0x14399c7f0>

Perspective transform

In [6]:
def corners_unwarp(img, src, mtx, dist):
    # Write code to do the following steps
    # 1) Undistort using mtx and dist
    # 2) define 4 destination points dst = np.float32([[,],[,],[,],[,]])
    # 3) use cv2.getPerspectiveTransform() to get M, the transform matrix
    # 4) use cv2.warpPerspective() to warp your image to a top-down view
    
    # Use the OpenCV undistort() function to remove distortion
    undist = cv2.undistort(img, mtx, dist, None, mtx)
    # Search for corners in the grayscaled image
    # Choose offset from image corners to plot detected corners
    # This should be chosen to present the result at the proper aspect ratio
    # My choice of 250 pixels is not exact, but close enough for our purpose here
    offset = 250 # offset for dst points
    # Grab the image shape
    img_size = (undist.shape[1], undist.shape[0])

    # For destination points, I'm arbitrarily choosing some points to be
    # a nice fit for displaying our warped result 
    # again, not exact, but close enough for our purposes
    dst = np.float32([[src[0,0] - offset, 0], [src[1,0] + offset, 0], \
                      [src[1,0] + offset, src[2,1]], [src[0,0] - offset, src[3,1]]])
    print(dst)
    # Given src and dst points, calculate the perspective transform matrix
    M = cv2.getPerspectiveTransform(src, dst)
    MInv = cv2.getPerspectiveTransform(dst, src)

    # Warp the image using OpenCV warpPerspective()
    warped = cv2.warpPerspective(undist, M, img_size, flags=cv2.INTER_LINEAR)

    return warped, M, MInv
In [7]:
image=plt.imread('test_images/straight_lines1.jpg')
src = np.float32([[592,450],[688,450],[1125,720],[190,720]])

cv2.line(image, tuple(src[0]), tuple(src[1]), color=[255,0,0], thickness=1)
cv2.line(image, tuple(src[1]), tuple(src[2]), color=[255,0,0], thickness=1)
cv2.line(image, tuple(src[2]), tuple(src[3]), color=[255,0,0], thickness=1)
cv2.line(image, tuple(src[3]), tuple(src[0]), color=[255,0,0], thickness=1)


top_down, M, MInv = corners_unwarp(image, src, mtx, dist)
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(image)
ax1.set_title('Original Image', fontsize=50)
ax2.imshow(top_down)
ax2.set_title('Undistorted and Warped Image', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)
[[ 342.    0.]
 [ 938.    0.]
 [ 938.  720.]
 [ 342.  720.]]

Binarize the image and ploynomial fit the lane line

Binarize based on the settings in the previous section

In [8]:
def binarize(image):
    # Apply each of the thresholding functions
    gradx = abs_sobel_thresh(image, orient='x', sobel_kernel=5, thresh=(20, 100))
    grady = abs_sobel_thresh(image, orient='y', sobel_kernel=5, thresh=(20, 100))
    mag_binary = mag_thresh(image, sobel_kernel=5, mag_thresh=(30, 255))
    dir_binary = dir_threshold(image, sobel_kernel=15, thresh=(0.9, 1.1))

    sb_combined = np.zeros_like(dir_binary)
    sb_combined[((gradx == 1) & (grady == 1)) | ((mag_binary == 1) & (dir_binary == 1))] = 1
    
    hls_binary = hls_select(image, s_thresh=(120, 255))

    color_binary = np.dstack(( np.zeros_like(hls_binary), hls_binary, sb_combined))

    # Combine the two binary thresholds
    combined_binary = np.zeros_like(hls_binary)
    combined_binary[(hls_binary == 1) | (sb_combined == 1)] = 1
    
    return color_binary, combined_binary

Keep only the lane line part by masking the region of interest

In [9]:
def region_of_interest(img, vertices):
    """
    Applies an image mask.
    
    Only keeps the region of the image defined by the polygon
    formed from `vertices`. The rest of the image is set to black.
    """
    #defining a blank mask to start with
    mask = np.zeros_like(img)   
    
    #defining a 3 channel or 1 channel color to fill the mask with depending on the input image
    if len(img.shape) > 2:
        channel_count = img.shape[2]  # i.e. 3 or 4 depending on your image
        ignore_mask_color = (255,) * channel_count
    else:
        ignore_mask_color = 255
        
    #filling pixels inside the polygon defined by "vertices" with the fill color    
    cv2.fillPoly(mask, vertices, ignore_mask_color)
    
    #returning the image only where mask pixels are nonzero
    masked_image = cv2.bitwise_and(img, mask)
    return masked_image

Start developing a pipeline with previously defined methods: undistort + binarize

In [10]:
image=plt.imread('test_images/test1.jpg')
undist = cv2.undistort(image, mtx, dist, None, mtx)
plt.figure(figsize=(24,9))
plt.imshow(undist)
plt.title('Input image')
b_color, b_combined = binarize(undist)
f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(b_color)
ax1.set_title('Stacked Color Gradient + Color space', fontsize=50)
ax2.imshow(b_combined, cmap='gray')
ax2.set_title('Binarized Combined', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

Region of interest + change perspective to bird eye view

In [11]:
imshape = b_combined.shape
vertices = np.array([[(100, imshape[0]),(imshape[1]/2-10, imshape[0]/2+42),(imshape[1]/2+10, imshape[0]/2+42), (imshape[1], imshape[0])]], dtype=np.int32)

roi = region_of_interest(b_combined, vertices)

img_size = (undist.shape[1], undist.shape[0])

# Warp the image using OpenCV warpPerspective()
binary_warped = cv2.warpPerspective(roi, M, img_size, flags=cv2.INTER_LINEAR)

f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9))
f.tight_layout()
ax1.imshow(roi, cmap='gray')
ax1.set_title('Binary ROI Image', fontsize=50)
ax2.imshow(binary_warped, cmap='gray')
ax2.set_title('Binary Undistorted and Warped Image', fontsize=50)
plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.)

Save the camera matrix, distortion coefficients, perspective matrix and its inverse for future use

In [13]:
import pickle
dist_pickle = {}
dist_pickle['mtx'] = mtx
dist_pickle['dist'] = dist
dist_pickle['M'] = M
dist_pickle['MInv'] = MInv
pickle.dump(dist_pickle, open( "dist.p", "wb" ) )

Use 2nd order polynominal to fit the lane line

In [14]:
def fit_lane_line(binary_warped, left_fit = None, right_fit = None):
    # Assuming you have created a warped binary image called "binary_warped"
    # Take a histogram of the bottom half of the image

    # Identify the x and y positions of all nonzero pixels in the image
    nonzero = binary_warped.nonzero()
    nonzeroy = np.array(nonzero[0])
    nonzerox = np.array(nonzero[1])
    out_img = np.dstack((binary_warped, binary_warped, binary_warped))*255

    # only need to search within the margin of previous frame's curves
    if left_fit != None and right_fit != None:
        margin = 100
        left_lane_inds = ((nonzerox > (left_fit[0]*(nonzeroy**2) + left_fit[1]*nonzeroy + left_fit[2] - margin)) & (nonzerox < (left_fit[0]*(nonzeroy**2) + left_fit[1]*nonzeroy + left_fit[2] + margin))) 
        right_lane_inds = ((nonzerox > (right_fit[0]*(nonzeroy**2) + right_fit[1]*nonzeroy + right_fit[2] - margin)) & (nonzerox < (right_fit[0]*(nonzeroy**2) + right_fit[1]*nonzeroy + right_fit[2] + margin)))  
    else:
        print("first frame")
        histogram = np.sum(binary_warped[360:,:], axis=0)
        # Create an output image to draw on and  visualize the result
        # Find the peak of the left and right halves of the histogram
        # These will be the starting point for the left and right lines
        midpoint = np.int(histogram.shape[0]/2)
        leftx_base = np.argmax(histogram[:midpoint])
        rightx_base = np.argmax(histogram[midpoint:]) + midpoint

        # Choose the number of sliding windows
        nwindows = 9
        # Set height of windows
        window_height = np.int(binary_warped.shape[0]/nwindows)

        # Current positions to be updated for each window
        leftx_current = leftx_base
        rightx_current = rightx_base
        # Set the width of the windows +/- margin
        margin = 100
        # Set minimum number of pixels found to recenter window
        minpix = 50
        # Create empty lists to receive left and right lane pixel indices
        left_lane_inds = []
        right_lane_inds = []

        # Step through the windows one by one
        for window in range(nwindows):
            # Identify window boundaries in x and y (and right and left)
            win_y_low = binary_warped.shape[0] - (window+1)*window_height
            win_y_high = binary_warped.shape[0] - window*window_height
            win_xleft_low = leftx_current - margin
            win_xleft_high = leftx_current + margin
            win_xright_low = rightx_current - margin
            win_xright_high = rightx_current + margin
            # Draw the windows on the visualization image
            cv2.rectangle(out_img,(win_xleft_low,win_y_low),(win_xleft_high,win_y_high),(0,255,0), 2) 
            cv2.rectangle(out_img,(win_xright_low,win_y_low),(win_xright_high,win_y_high),(0,255,0), 2) 
            # Identify the nonzero pixels in x and y within the window
            good_left_inds = ((nonzeroy >= win_y_low) & (nonzeroy < win_y_high) & (nonzerox >= win_xleft_low) & (nonzerox < win_xleft_high)).nonzero()[0]
            good_right_inds = ((nonzeroy >= win_y_low) & (nonzeroy < win_y_high) & (nonzerox >= win_xright_low) & (nonzerox < win_xright_high)).nonzero()[0]
            # Append these indices to the lists
            left_lane_inds.append(good_left_inds)
            right_lane_inds.append(good_right_inds)
            # If you found > minpix pixels, recenter next window on their mean position
            if len(good_left_inds) > minpix:
                leftx_current = np.int(np.mean(nonzerox[good_left_inds]))
            if len(good_right_inds) > minpix:        
                rightx_current = np.int(np.mean(nonzerox[good_right_inds]))

        # Concatenate the arrays of indices
        left_lane_inds = np.concatenate(left_lane_inds)
        right_lane_inds = np.concatenate(right_lane_inds)
    

    # Extract left and right line pixel positions
    leftx = nonzerox[left_lane_inds]
    lefty = nonzeroy[left_lane_inds] 
    rightx = nonzerox[right_lane_inds]
    righty = nonzeroy[right_lane_inds] 

    # Fit a second order polynomial to each
    left_fit = np.polyfit(lefty, leftx, 2)
    right_fit = np.polyfit(righty, rightx, 2)
    # Generate x and y values for plotting
    ploty = np.linspace(0, binary_warped.shape[0]-1, binary_warped.shape[0] )
    left_fitx = left_fit[0]*ploty**2 + left_fit[1]*ploty + left_fit[2]
    right_fitx = right_fit[0]*ploty**2 + right_fit[1]*ploty + right_fit[2]
    out_img[nonzeroy[left_lane_inds], nonzerox[left_lane_inds]] = [255, 0, 0]
    out_img[nonzeroy[right_lane_inds], nonzerox[right_lane_inds]] = [0, 0, 255]

    return out_img, left_fitx, right_fitx, ploty, left_fit, right_fit
In [15]:
out_img, left_fitx, right_fitx, ploty, left_fit, right_fit = fit_lane_line(binary_warped)
plt.figure(figsize=(24, 9))
plt.imshow(out_img)
plt.plot(left_fitx, ploty, color='yellow')
plt.plot(right_fitx, ploty, color='yellow')
plt.xlim(0, 1280)
plt.ylim(720, 0)
first frame
Out[15]:
(720, 0)

Calculate the curve radius and offset to centor of road in unit of meters

In [16]:
def get_stats(ploty, left_fit, right_fit):
    # Define y-value where we want radius of curvature
    # I'll choose the maximum y-value, corresponding to the bottom of the image
    y_eval = np.max(ploty)
    
    # Define conversions in x and y from pixels space to meters
    ym_per_pix = 30/720 # meters per pixel in y dimension
    xm_per_pix = 3.7/700 # meters per pixel in x dimension

    leftx = left_fit[0]*ploty**2 + left_fit[1]*ploty + left_fit[2]
    rightx = right_fit[0]*ploty**2 + right_fit[1]*ploty + right_fit[2]
    
    # Fit new polynomials to x,y in world space
    left_fit_cr = np.polyfit(ploty*ym_per_pix, leftx*xm_per_pix, 2)
    right_fit_cr = np.polyfit(ploty*ym_per_pix, rightx*xm_per_pix, 2)
    # Calculate the new radii of curvature
    left_curverad = ((1 + (2*left_fit_cr[0]*y_eval*ym_per_pix + left_fit_cr[1])**2)**1.5) / np.absolute(2*left_fit_cr[0])
    right_curverad = ((1 + (2*right_fit_cr[0]*y_eval*ym_per_pix + right_fit_cr[1])**2)**1.5) / np.absolute(2*right_fit_cr[0])
    # Now our radius of curvature is in meters
    line_pos_left = left_fit[0]*y_eval**2 + left_fit[1]*y_eval + left_fit[2]
    line_pos_right = right_fit[0]*y_eval**2 + right_fit[1]*y_eval + right_fit[2]
    offset = ((line_pos_left + line_pos_right) / 2 - 640) * xm_per_pix
    return left_curverad, right_curverad, offset, line_pos_left, line_pos_right
In [17]:
print(get_stats(ploty, left_fit, right_fit))
(1167.0040611385377, 475.50979799082, 0.13768365073003938, 367.21990145555054, 964.87661503689674)

Project the lane line area back to undistorted input image

In [18]:
def project_lane_lines(binary_warped, undist, left_fitx, right_fitx, ploty, MInv):
    # Create an image to draw the lines on
    warp_zero = np.zeros_like(binary_warped).astype(np.uint8)
    color_warp = np.dstack((warp_zero, warp_zero, warp_zero))

    # Recast the x and y points into usable format for cv2.fillPoly()
    pts_left = np.array([np.transpose(np.vstack([left_fitx, ploty]))])
    pts_right = np.array([np.flipud(np.transpose(np.vstack([right_fitx, ploty])))])
    pts = np.hstack((pts_left, pts_right))
    # Draw the lane onto the warped blank image
    cv2.fillPoly(color_warp, np.int_([pts]), (0,255, 0))

    # Warp the blank back to original image space using inverse perspective matrix (Minv)
    newwarp = cv2.warpPerspective(color_warp, MInv, (image.shape[1], image.shape[0])) 
    # Combine the result with the original image

    result = cv2.addWeighted(undist, 1, newwarp, 0.3, 0)
    return result
    
In [19]:
result = project_lane_lines(binary_warped, undist, left_fitx, right_fitx, ploty, MInv)
left_curverad, right_curverad, offset, line_pos_left, line_pos_right = get_stats(ploty, left_fit, right_fit)
str_curverad = 'Radius of curvature = {0:.2f}m'.format((left_curverad + right_curverad) / 2)
str_offset = 'Vehicle is {} m {} from center'.format(round(offset,2), 'right' if offset > 0 else 'left')
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(result,str_curverad,(0,100), font, 2,(255,255,255),2,cv2.LINE_AA)
cv2.putText(result,str_offset,(0,200), font, 2,(255,255,255),2,cv2.LINE_AA)    
plt.figure(figsize=(24, 9))
plt.imshow(result)
Out[19]:
<matplotlib.image.AxesImage at 0x11365c4e0>
In [20]:
def process_image(img_path, mtx, dist, M, MInv):
    image=plt.imread(img_path)
    undist = cv2.undistort(image, mtx, dist, None, mtx)
    b_color, b_combined = binarize(undist)
    imshape = b_combined.shape
    vertices = np.array([[(100, imshape[0]),(imshape[1]/2-10, imshape[0]/2+42),(imshape[1]/2+10, imshape[0]/2+42), (imshape[1], imshape[0])]], dtype=np.int32)
    roi = region_of_interest(b_combined, vertices)
    img_size = (imshape[1], imshape[0])
    # Warp the image using OpenCV warpPerspective()
    binary_warped = cv2.warpPerspective(roi, M, img_size, flags=cv2.INTER_LINEAR)
    out_img, left_fitx, right_fitx, ploty, left_fit, right_fit = fit_lane_line(binary_warped)
    result = project_lane_lines(binary_warped, undist, left_fitx, right_fitx, ploty, MInv)
    left_curverad, right_curverad, offset, line_pos_left, line_pos_right = get_stats(ploty, left_fit, right_fit)
    str_curverad = 'Radius of curvature = {0:.2f}m'.format((left_curverad + right_curverad) / 2)
    str_offset = 'Vehicle is {} m {} from center'.format(round(offset,2), 'right' if offset > 0 else 'left')
    font = cv2.FONT_HERSHEY_SIMPLEX
    cv2.putText(result,str_curverad,(0,100), font, 2,(255,255,255),2,cv2.LINE_AA)
    cv2.putText(result,str_offset,(0,200), font, 2,(255,255,255),2,cv2.LINE_AA)    
    plt.figure(figsize=(24, 9))
    plt.imshow(result)
In [21]:
process_image('test_images/test6.jpg', mtx, dist, M, MInv)
first frame

Video Pipeline and Sanity check of detected lane lines

In [22]:
# Define a class to receive the characteristics of each line detection
class Line():
    def __init__(self):
        # was the line detected in the last iteration?
        self.detected = False  
        # x values of the last n fits of the line
        self.recent_xfitted = [] 
        # average x values of the fitted line over the last n iterations
        self.bestx = None    
        # polynomial coefficients of the last n fits
        self.recent_fits = []
        #polynomial coefficients averaged over the last n iterations
        self.best_fit = None  
        #polynomial coefficients for the most recent fit
        self.current_fit = [np.array([False])]  
        #radius of curvature of the line in some units
        self.radius_of_curvature = None 
        #distance in meters of vehicle center from the line
        self.line_base_pos = None 
        #x values for detected line pixels
        self.allx = None  
        
    def update(self, pos, curverad, fit, fitx):
        self.detected = True
        self.radius_of_curvature = curverad
        self.current_fit = fit
        self.allx = fitx
        if len(self.recent_xfitted) > 5:
            self.recent_xfitted.pop(0)
        self.recent_xfitted.append(pos)
        self.bestx = sum(self.recent_xfitted) / len(self.recent_xfitted)
        if len(self.recent_fits) > 5:
            self.recent_fits.pop(0)
        self.recent_fits.append(fit)
        self.best_fit = [x/len(self.recent_fits) for x in [ sum(x) for x in zip(*self.recent_fits) ]]
        
In [23]:
def line_sanity(left, right, line_pos_left, line_pos_right, left_curverad, right_curverad, left_fit, right_fit, left_fitx, right_fitx):
    # left and right line has similar curvature
    if np.linalg.norm(left_fit - right_fit) / np.linalg.norm((left_fit+right_fit)/2) < 1.3:
        # left and right line are not too far away from center
        if 640 - line_pos_left < 500 and line_pos_right - 640 < 500:
            # left and right x position are not too far from previous detection
            if abs(left.bestx - line_pos_left) < 25 and abs(right.bestx - line_pos_right) < 25:
                # left and right coefficients are close to previous detection
                if np.linalg.norm(left_fit - left.best_fit) < 200 and np.linalg.norm(right_fit - right.best_fit) < 200:
                    # radius difference within 10x
                    if max(left_curverad,right_curverad) / min(left_curverad,right_curverad) < 10:
                        left.update(line_pos_left, left_curverad, left_fit, left_fitx)
                        right.update(line_pos_right, right_curverad, right_fit, right_fitx)
                        return True
                    else:
                        print(abs(left_curverad - right_curverad))
                        print('failed sanity: radius diff')
                else:
                    print(np.linalg.norm(left_fit - left.best_fit))
                    print(np.linalg.norm(right_fit - right.best_fit))
                    print('failed sanity: left and right line coefficient')
            else:
                print(abs(left.bestx - line_pos_left))
                print(abs(right.bestx - line_pos_right))
                print('failed sanity: line distance from previous detection')
        else:
            print('failed sanity: line distance from center')
    else:
        print(np.linalg.norm(left_fit - right_fit) / np.linalg.norm((left_fit+right_fit)/2))
        print('failed sanity: left and right line curvature')
    left.detected = False
    right.detected = False
    return False     
In [26]:
def process_image_in_video(image):
    global mtx
    global dist
    global M
    global MInv
    global left_fit_prev
    global right_fit_prev
    global left
    global right
    global frame_count
    undist = cv2.undistort(image, mtx, dist, None, mtx)
    b_color, b_combined = binarize(undist)
    imshape = b_combined.shape
    vertices = np.array([[(100, imshape[0]),(imshape[1]/2-10, imshape[0]/2+42),(imshape[1]/2+10, imshape[0]/2+42), (imshape[1], imshape[0])]], dtype=np.int32)
    roi = region_of_interest(b_combined, vertices)
    img_size = (imshape[1], imshape[0])
    # Warp the image using OpenCV warpPerspective()
    binary_warped = cv2.warpPerspective(roi, M, img_size, flags=cv2.INTER_LINEAR)
    try:
        out_img, left_fitx, right_fitx, ploty, left_fit, right_fit = fit_lane_line(binary_warped, left_fit_prev, right_fit_prev)
    except:
        left_fitx = left.allx
        right_fitx = right.allx
        ploty = np.linspace(0, binary_warped.shape[0]-1, binary_warped.shape[0] )
        left_fit = left.current_fit
        right_fit = right.current_fit

    left_curverad, right_curverad, offset, line_pos_left, line_pos_right = get_stats(ploty, left_fit, right_fit)
    # sanity check, if detected, update and use the new line detected, otherwise use the previous line
    if 0 == frame_count:
        result = project_lane_lines(binary_warped, undist, left_fitx, right_fitx, ploty, MInv)
        left.update(line_pos_left, left_curverad, left_fit, left_fitx)
        right.update(line_pos_right, right_curverad, right_fit, right_fitx)
    elif line_sanity(left, right, line_pos_left, line_pos_right, left_curverad, right_curverad, left_fit, right_fit, left_fitx, right_fitx):
        result = project_lane_lines(binary_warped, undist, left_fitx, right_fitx, ploty, MInv)
        left_fit_prev = left_fit
        right_fit_prev = right_fit
    else:
        result = project_lane_lines(binary_warped, undist, left.allx, right.allx, ploty, MInv)
        left_curverad, right_curverad, offset, line_pos_left, line_pos_right = get_stats(ploty, left.current_fit, right.current_fit)

    str_curverad = 'Radius of curvature = {0:.2f}m'.format((left_curverad + right_curverad) / 2)
    str_offset = 'Vehicle is {} m {} from center'.format(round(abs(offset),2), 'right' if offset > 0 else 'left')
    font = cv2.FONT_HERSHEY_SIMPLEX
    cv2.putText(result,str_curverad,(0,100), font, 2,(255,255,255),2,cv2.LINE_AA)
    cv2.putText(result,str_offset,(0,200), font, 2,(255,255,255),2,cv2.LINE_AA) 
    
    frame_count += 1
    return result
In [27]:
# Import everything needed to edit/save/watch video clips
from moviepy.editor import VideoFileClip
out_dir='./'
output = out_dir+'processed_project_video.mp4'
left_fit_prev = right_fit_prev = None
frame_count = 0
left, right = Line(), Line()
clip = VideoFileClip("project_video.mp4")
out_clip = clip.fl_image(process_image_in_video) 
%time out_clip.write_videofile(output, audio=False)
first frame
[MoviePy] >>>> Building video ./processed_project_video.mp4
[MoviePy] Writing video ./processed_project_video.mp4
  0%|          | 1/1261 [00:00<06:13,  3.38it/s]
first frame
7328.90839543
failed sanity: radius diff
  0%|          | 2/1261 [00:00<06:05,  3.45it/s]
first frame
  0%|          | 3/1261 [00:00<05:59,  3.50it/s]
17378.5884457
failed sanity: radius diff
  1%|          | 13/1261 [00:03<05:36,  3.71it/s]
5101.08717263
failed sanity: radius diff
  1%|▏         | 16/1261 [00:04<05:26,  3.82it/s]
7324.14534506
failed sanity: radius diff
  1%|▏         | 17/1261 [00:04<05:21,  3.87it/s]
6221.63215801
failed sanity: radius diff
  2%|▏         | 21/1261 [00:05<05:06,  4.04it/s]
1.32649053365
failed sanity: left and right line curvature
  2%|▏         | 22/1261 [00:05<05:07,  4.03it/s]
1.38601634876
failed sanity: left and right line curvature
  2%|▏         | 23/1261 [00:06<05:09,  4.00it/s]
1.40417421439
failed sanity: left and right line curvature
  2%|▏         | 24/1261 [00:06<05:07,  4.02it/s]
1.38789130568
failed sanity: left and right line curvature
  3%|▎         | 43/1261 [00:10<04:56,  4.11it/s]
1.31972774747
failed sanity: left and right line curvature
  3%|▎         | 44/1261 [00:11<04:58,  4.07it/s]
1.35212129562
failed sanity: left and right line curvature
  4%|▎         | 45/1261 [00:11<04:59,  4.06it/s]
1.3410854208
failed sanity: left and right line curvature
  4%|▎         | 46/1261 [00:11<05:00,  4.05it/s]
1.42952641561
failed sanity: left and right line curvature
  4%|▎         | 47/1261 [00:11<05:02,  4.02it/s]
1.42103940623
failed sanity: left and right line curvature
  4%|▍         | 48/1261 [00:12<05:06,  3.96it/s]
1.4143457095
failed sanity: left and right line curvature
  4%|▍         | 49/1261 [00:12<05:05,  3.96it/s]
1.41727921407
failed sanity: left and right line curvature
  4%|▍         | 50/1261 [00:12<05:05,  3.96it/s]
1.40957643728
failed sanity: left and right line curvature
  5%|▍         | 59/1261 [00:15<05:39,  3.54it/s]
1.34700068967
failed sanity: left and right line curvature
  5%|▍         | 63/1261 [00:16<05:36,  3.56it/s]
6806.47423622
failed sanity: radius diff
  5%|▌         | 64/1261 [00:16<05:39,  3.53it/s]
12197.8673616
failed sanity: radius diff
  5%|▌         | 65/1261 [00:16<05:49,  3.42it/s]
128377.092746
failed sanity: radius diff
  5%|▌         | 66/1261 [00:17<05:53,  3.38it/s]
4472.6722518
failed sanity: radius diff
  6%|▋         | 79/1261 [00:20<05:04,  3.88it/s]
17353.6001417
failed sanity: radius diff
  7%|▋         | 84/1261 [00:21<05:09,  3.80it/s]
1.36362563399
failed sanity: left and right line curvature
  9%|▊         | 109/1261 [00:28<04:43,  4.07it/s]
1.34507932836
failed sanity: left and right line curvature
  9%|▉         | 115/1261 [00:29<04:40,  4.09it/s]
8461.65785861
failed sanity: radius diff
  9%|▉         | 116/1261 [00:30<04:43,  4.03it/s]
5582.09009557
failed sanity: radius diff
 11%|█▏        | 142/1261 [00:36<04:38,  4.01it/s]
8526.25969231
failed sanity: radius diff
 12%|█▏        | 152/1261 [00:39<04:39,  3.97it/s]
6344.0806242
failed sanity: radius diff
 12%|█▏        | 154/1261 [00:39<04:35,  4.01it/s]
4866.60033923
failed sanity: radius diff
 12%|█▏        | 155/1261 [00:39<04:34,  4.02it/s]
7662.77923971
failed sanity: radius diff
 13%|█▎        | 161/1261 [00:41<04:39,  3.93it/s]
5818.68832448
failed sanity: radius diff
 13%|█▎        | 167/1261 [00:42<04:34,  3.99it/s]
13558.6705773
failed sanity: radius diff
 14%|█▎        | 171/1261 [00:43<04:44,  3.84it/s]
1.31960207878
failed sanity: left and right line curvature
 14%|█▎        | 172/1261 [00:44<04:45,  3.81it/s]
1.44377675525
failed sanity: left and right line curvature
 14%|█▎        | 173/1261 [00:44<04:46,  3.80it/s]
1.43093552676
failed sanity: left and right line curvature
 14%|█▍        | 174/1261 [00:44<04:44,  3.82it/s]
1.40500775284
failed sanity: left and right line curvature
 14%|█▍        | 175/1261 [00:44<04:42,  3.84it/s]
1.42986462548
failed sanity: left and right line curvature
 15%|█▍        | 184/1261 [00:47<05:19,  3.37it/s]
1.32944871279
failed sanity: left and right line curvature
 15%|█▍        | 188/1261 [00:48<04:41,  3.81it/s]
1.49131544697
failed sanity: left and right line curvature
 15%|█▌        | 194/1261 [00:49<04:23,  4.05it/s]
2949.11827023
failed sanity: radius diff
 16%|█▌        | 197/1261 [00:50<04:20,  4.09it/s]
1.3703858714
failed sanity: left and right line curvature
 16%|█▌        | 198/1261 [00:50<04:21,  4.07it/s]
1.33233854686
failed sanity: left and right line curvature
 16%|█▌        | 199/1261 [00:51<04:21,  4.06it/s]
1.3995882413
failed sanity: left and right line curvature
 16%|█▋        | 208/1261 [00:53<04:24,  3.98it/s]
1.3292884604
failed sanity: left and right line curvature
 17%|█▋        | 210/1261 [00:53<04:20,  4.03it/s]
1.35246067879
failed sanity: left and right line curvature
 17%|█▋        | 218/1261 [00:55<04:22,  3.97it/s]
1.31906223049
failed sanity: left and right line curvature
 18%|█▊        | 221/1261 [00:56<05:11,  3.33it/s]
1.3222294784
failed sanity: left and right line curvature
 18%|█▊        | 222/1261 [00:57<05:27,  3.17it/s]
1.32184214176
failed sanity: left and right line curvature
 18%|█▊        | 223/1261 [00:57<05:27,  3.17it/s]
1.30897504722
failed sanity: left and right line curvature
 18%|█▊        | 225/1261 [00:58<05:11,  3.32it/s]
1.33559858049
failed sanity: left and right line curvature
 18%|█▊        | 226/1261 [00:58<05:04,  3.40it/s]
1.32025820101
failed sanity: left and right line curvature
 18%|█▊        | 227/1261 [00:58<05:01,  3.44it/s]
1.32550422525
failed sanity: left and right line curvature
 18%|█▊        | 228/1261 [00:58<04:56,  3.48it/s]
1.32842120281
failed sanity: left and right line curvature
 18%|█▊        | 229/1261 [00:59<04:55,  3.49it/s]
1.31289423114
failed sanity: left and right line curvature
 18%|█▊        | 231/1261 [00:59<04:48,  3.57it/s]
1.32030774057
failed sanity: left and right line curvature
 18%|█▊        | 232/1261 [00:59<04:56,  3.47it/s]
1.32263693597
failed sanity: left and right line curvature
 18%|█▊        | 233/1261 [01:00<04:48,  3.56it/s]
1.45079646093
failed sanity: left and right line curvature
 19%|█▊        | 234/1261 [01:00<04:49,  3.55it/s]
1.3034233909
failed sanity: left and right line curvature
 19%|█▉        | 240/1261 [01:02<04:31,  3.76it/s]
1.30291252755
failed sanity: left and right line curvature
 19%|█▉        | 242/1261 [01:02<04:26,  3.83it/s]
1.32865152585
failed sanity: left and right line curvature
 19%|█▉        | 243/1261 [01:02<04:25,  3.84it/s]
1.33095578894
failed sanity: left and right line curvature
 19%|█▉        | 245/1261 [01:03<04:23,  3.85it/s]
1.31530568897
failed sanity: left and right line curvature
 20%|██        | 254/1261 [01:05<04:38,  3.61it/s]
4178.84892546
failed sanity: radius diff
 20%|██        | 255/1261 [01:06<04:38,  3.62it/s]
15271.9914593
failed sanity: radius diff
 20%|██        | 258/1261 [01:06<04:40,  3.58it/s]
1.32466578805
failed sanity: left and right line curvature
 22%|██▏       | 276/1261 [01:12<04:37,  3.55it/s]
48306.1549095
failed sanity: radius diff
 22%|██▏       | 277/1261 [01:12<04:40,  3.51it/s]
11213.4955994
failed sanity: radius diff
 22%|██▏       | 279/1261 [01:13<04:29,  3.65it/s]
4591.17545211
failed sanity: radius diff
 24%|██▍       | 300/1261 [01:18<04:11,  3.83it/s]
31338.8846357
failed sanity: radius diff
 24%|██▍       | 305/1261 [01:20<04:24,  3.62it/s]
23180.4612536
failed sanity: radius diff
 25%|██▍       | 310/1261 [01:21<04:07,  3.84it/s]
116068.542823
failed sanity: radius diff
 27%|██▋       | 340/1261 [01:29<03:58,  3.86it/s]
12511.4909919
failed sanity: radius diff
 27%|██▋       | 342/1261 [01:30<03:58,  3.85it/s]
1.94293825512
26.9464220085
failed sanity: line distance from previous detection
 28%|██▊       | 350/1261 [01:32<03:59,  3.81it/s]
72212.6116408
failed sanity: radius diff
 29%|██▉       | 365/1261 [01:36<03:57,  3.77it/s]
2.23081243283
27.3173177745
failed sanity: line distance from previous detection
 29%|██▉       | 371/1261 [01:38<03:58,  3.74it/s]
6146.88607127
failed sanity: radius diff
 31%|███       | 388/1261 [01:42<03:55,  3.71it/s]
15549.4422196
failed sanity: radius diff
 31%|███       | 393/1261 [01:44<03:49,  3.79it/s]
57615.2256289
failed sanity: radius diff
 32%|███▏      | 408/1261 [01:48<03:44,  3.79it/s]
57305.7498906
failed sanity: radius diff
 34%|███▍      | 426/1261 [01:52<03:39,  3.80it/s]
4765.44498087
failed sanity: radius diff
 34%|███▍      | 427/1261 [01:53<03:38,  3.82it/s]
11304.4521528
failed sanity: radius diff
 34%|███▍      | 428/1261 [01:53<03:36,  3.85it/s]
12574.5308269
failed sanity: radius diff
 35%|███▍      | 436/1261 [01:55<03:34,  3.85it/s]
11589.1057982
failed sanity: radius diff
 35%|███▍      | 437/1261 [01:55<03:33,  3.86it/s]
4.85167452751
36.1647514436
failed sanity: line distance from previous detection
 35%|███▍      | 438/1261 [01:55<03:35,  3.81it/s]
79127.1201394
failed sanity: radius diff
 35%|███▍      | 441/1261 [01:56<03:31,  3.88it/s]
32928.596113
failed sanity: radius diff
 35%|███▌      | 442/1261 [01:56<03:34,  3.82it/s]
13866.0807948
failed sanity: radius diff
 35%|███▌      | 446/1261 [01:57<03:32,  3.84it/s]
8078.33990705
failed sanity: radius diff
 36%|███▌      | 450/1261 [01:58<03:27,  3.91it/s]
67779.2045127
failed sanity: radius diff
 36%|███▌      | 451/1261 [01:59<03:26,  3.92it/s]
6815.80209447
failed sanity: radius diff
 36%|███▌      | 452/1261 [01:59<03:29,  3.86it/s]
6809.79776053
failed sanity: radius diff
 36%|███▌      | 453/1261 [01:59<03:28,  3.87it/s]
10472.4203726
failed sanity: radius diff
 37%|███▋      | 463/1261 [02:02<03:25,  3.88it/s]
6056.9936576
failed sanity: radius diff
 37%|███▋      | 471/1261 [02:04<03:25,  3.85it/s]
41851.5802666
failed sanity: radius diff
 38%|███▊      | 476/1261 [02:05<03:25,  3.83it/s]
28241.9469567
failed sanity: radius diff
 38%|███▊      | 477/1261 [02:05<03:24,  3.84it/s]
5785.70989747
failed sanity: radius diff
 38%|███▊      | 478/1261 [02:06<03:24,  3.83it/s]
11543.4567411
failed sanity: radius diff
 38%|███▊      | 479/1261 [02:06<03:25,  3.81it/s]
16292.4266323
failed sanity: radius diff
 38%|███▊      | 480/1261 [02:06<03:24,  3.82it/s]
60725.0129977
failed sanity: radius diff
 38%|███▊      | 485/1261 [02:08<03:20,  3.86it/s]
602789.647022
failed sanity: radius diff
 39%|███▊      | 488/1261 [02:08<03:21,  3.83it/s]
23718.7400085
failed sanity: radius diff
 39%|███▉      | 489/1261 [02:09<03:21,  3.83it/s]
8819.97558012
failed sanity: radius diff
 40%|████      | 509/1261 [02:14<03:14,  3.86it/s]
2.51135973406
37.2462035809
failed sanity: line distance from previous detection
 40%|████      | 510/1261 [02:14<03:17,  3.80it/s]
3.45834704894
32.1648419058
failed sanity: line distance from previous detection
 42%|████▏     | 527/1261 [02:18<03:06,  3.94it/s]
12880.8134917
failed sanity: radius diff
 42%|████▏     | 532/1261 [02:20<03:07,  3.89it/s]
37710.9743367
failed sanity: radius diff
 42%|████▏     | 533/1261 [02:20<03:04,  3.95it/s]
4.14558733896
25.6555136486
failed sanity: line distance from previous detection
 43%|████▎     | 539/1261 [02:21<03:08,  3.82it/s]
18574.568538
failed sanity: radius diff
 43%|████▎     | 540/1261 [02:22<03:07,  3.84it/s]
123933.44036
failed sanity: radius diff
 43%|████▎     | 542/1261 [02:22<03:08,  3.82it/s]
27043.3498595
failed sanity: radius diff
 44%|████▍     | 561/1261 [02:27<02:58,  3.92it/s]
1.33009391178
failed sanity: left and right line curvature
 45%|████▍     | 562/1261 [02:27<02:59,  3.90it/s]
1.36766775946
failed sanity: left and right line curvature
 45%|████▍     | 565/1261 [02:28<03:01,  3.84it/s]
0.899289562783
41.3803916013
failed sanity: line distance from previous detection
 46%|████▌     | 577/1261 [02:31<02:54,  3.92it/s]
4.68653861276
34.4331632003
failed sanity: line distance from previous detection
 46%|████▌     | 578/1261 [02:31<02:53,  3.93it/s]
0.341161186238
29.5128020639
failed sanity: line distance from previous detection
 47%|████▋     | 595/1261 [02:36<02:45,  4.02it/s]
1.33747678966
failed sanity: left and right line curvature
 47%|████▋     | 598/1261 [02:36<02:43,  4.06it/s]
1.39158545717
failed sanity: left and right line curvature
 48%|████▊     | 599/1261 [02:37<02:42,  4.07it/s]
1.35499892761
failed sanity: left and right line curvature
 48%|████▊     | 604/1261 [02:38<02:43,  4.03it/s]
17328.6189162
failed sanity: radius diff
 48%|████▊     | 606/1261 [02:38<02:39,  4.10it/s]
206.659729474
315.042190707
failed sanity: left and right line coefficient
 48%|████▊     | 607/1261 [02:39<02:39,  4.11it/s]
223.546070479
82.2378852038
failed sanity: left and right line coefficient
 48%|████▊     | 608/1261 [02:39<02:40,  4.07it/s]
211.712685072
431.934149766
failed sanity: left and right line coefficient
 48%|████▊     | 609/1261 [02:39<02:40,  4.06it/s]
189.231919407
765.758850494
failed sanity: left and right line coefficient
 48%|████▊     | 610/1261 [02:39<02:41,  4.03it/s]
44792.7724318
failed sanity: radius diff
 48%|████▊     | 611/1261 [02:40<02:41,  4.03it/s]
1.61673739658
failed sanity: left and right line curvature
 49%|████▊     | 612/1261 [02:40<02:40,  4.04it/s]
2.07004435179
failed sanity: left and right line curvature
 49%|████▊     | 613/1261 [02:40<02:41,  4.00it/s]
2.00882667382
failed sanity: left and right line curvature
 49%|████▊     | 614/1261 [02:40<02:40,  4.04it/s]
2.00828686351
failed sanity: left and right line curvature
 49%|████▉     | 615/1261 [02:41<02:38,  4.08it/s]
247.626454832
347.943081178
failed sanity: left and right line coefficient
 49%|████▉     | 616/1261 [02:41<02:39,  4.03it/s]
2.00460602074
failed sanity: left and right line curvature
 49%|████▉     | 619/1261 [02:42<02:38,  4.06it/s]
2.02314897573
failed sanity: left and right line curvature
 49%|████▉     | 620/1261 [02:42<02:39,  4.02it/s]
1.73892687263
failed sanity: left and right line curvature
 49%|████▉     | 621/1261 [02:42<02:37,  4.06it/s]
24.1885723719
35.0499422265
failed sanity: line distance from previous detection
 49%|████▉     | 622/1261 [02:42<02:38,  4.04it/s]
1.41174789823
failed sanity: left and right line curvature
 49%|████▉     | 623/1261 [02:43<02:39,  4.01it/s]
26.6446584247
31.1858378364
failed sanity: line distance from previous detection
 49%|████▉     | 624/1261 [02:43<02:41,  3.94it/s]
23.054327214
35.3364749996
failed sanity: line distance from previous detection
 50%|████▉     | 625/1261 [02:43<02:40,  3.96it/s]
12.7031290465
32.4536694099
failed sanity: line distance from previous detection
 50%|████▉     | 626/1261 [02:43<02:43,  3.89it/s]
8.64848158711
33.255322722
failed sanity: line distance from previous detection
 50%|████▉     | 627/1261 [02:44<02:41,  3.92it/s]
17.1884427752
failed sanity: left and right line curvature
 50%|████▉     | 628/1261 [02:44<02:42,  3.91it/s]
3.97180498937
27.2526244056
failed sanity: line distance from previous detection
 50%|████▉     | 629/1261 [02:44<02:41,  3.92it/s]
6.05374043179
258.185715175
failed sanity: line distance from previous detection
 50%|████▉     | 630/1261 [02:44<02:41,  3.90it/s]
1.43769303396
failed sanity: left and right line curvature
 50%|█████     | 631/1261 [02:45<02:41,  3.90it/s]
2343.59802359
failed sanity: radius diff
 50%|█████     | 632/1261 [02:45<02:41,  3.89it/s]
72.0412609561
262.308664984
failed sanity: left and right line coefficient
 50%|█████     | 634/1261 [02:45<02:41,  3.89it/s]
122.361452419
277.941752944
failed sanity: left and right line coefficient
 51%|█████     | 642/1261 [02:47<02:36,  3.97it/s]
1.69712915608
35.2340791574
failed sanity: line distance from previous detection
 51%|█████▏    | 647/1261 [02:49<02:38,  3.87it/s]
9832.95005528
failed sanity: radius diff
 51%|█████▏    | 648/1261 [02:49<02:38,  3.87it/s]
69758.4846512
failed sanity: radius diff
 62%|██████▏   | 776/1261 [03:22<02:05,  3.86it/s]
4.41283495167
27.5378128333
failed sanity: line distance from previous detection
 63%|██████▎   | 800/1261 [03:28<02:00,  3.83it/s]
80869.9963621
failed sanity: radius diff
 65%|██████▌   | 823/1261 [03:34<01:55,  3.78it/s]
3975.91953689
failed sanity: radius diff
 70%|██████▉   | 882/1261 [03:50<01:48,  3.50it/s]
2.50655730893
34.8900967296
failed sanity: line distance from previous detection
 74%|███████▍  | 930/1261 [04:02<01:26,  3.81it/s]
5.38517443108
27.9083244383
failed sanity: line distance from previous detection
 75%|███████▍  | 943/1261 [04:06<01:22,  3.84it/s]
7005.48770628
failed sanity: radius diff
 76%|███████▌  | 956/1261 [04:09<01:19,  3.82it/s]
10478.7183842
failed sanity: radius diff
 76%|███████▌  | 958/1261 [04:10<01:19,  3.80it/s]
30408.319938
failed sanity: radius diff
 76%|███████▋  | 962/1261 [04:11<01:17,  3.85it/s]
11187.9423904
failed sanity: radius diff
 77%|███████▋  | 967/1261 [04:12<01:16,  3.83it/s]
157327.466569
failed sanity: radius diff
 78%|███████▊  | 979/1261 [04:15<01:13,  3.84it/s]
8975.25376669
failed sanity: radius diff
 78%|███████▊  | 981/1261 [04:15<01:12,  3.87it/s]
4913.82231316
failed sanity: radius diff
 79%|███████▊  | 990/1261 [04:18<01:09,  3.91it/s]
9.67121005452
31.5212444406
failed sanity: line distance from previous detection
 79%|███████▉  | 1001/1261 [04:21<01:08,  3.81it/s]
16.6489282915
40.5147204079
failed sanity: line distance from previous detection
 79%|███████▉  | 1002/1261 [04:21<01:07,  3.81it/s]
26.0487327451
46.8417381271
failed sanity: line distance from previous detection
 80%|███████▉  | 1003/1261 [04:21<01:07,  3.83it/s]
32.5555443507
39.1453669043
failed sanity: line distance from previous detection
 80%|███████▉  | 1004/1261 [04:22<01:07,  3.81it/s]
33.7615358679
31.2540629634
failed sanity: line distance from previous detection
 80%|███████▉  | 1005/1261 [04:22<01:07,  3.81it/s]
36.5965109864
32.1493563271
failed sanity: line distance from previous detection
 80%|███████▉  | 1006/1261 [04:22<01:07,  3.81it/s]
28.2431552463
3.19205938975
failed sanity: line distance from previous detection
 80%|███████▉  | 1007/1261 [04:22<01:06,  3.84it/s]
31.1076027337
2.77038167177
failed sanity: line distance from previous detection
 80%|███████▉  | 1008/1261 [04:23<01:05,  3.85it/s]
26.5403285968
0.0656470350556
failed sanity: line distance from previous detection
 80%|████████  | 1009/1261 [04:23<01:05,  3.87it/s]
31.1510388998
2.43831085165
failed sanity: line distance from previous detection
 80%|████████  | 1010/1261 [04:23<01:05,  3.84it/s]
29.1463090391
4.60148707665
failed sanity: line distance from previous detection
 80%|████████  | 1011/1261 [04:23<01:05,  3.84it/s]
29.7658828085
10.1112384209
failed sanity: line distance from previous detection
 80%|████████  | 1012/1261 [04:24<01:04,  3.87it/s]
35.7780250011
9.27833175926
failed sanity: line distance from previous detection
 80%|████████  | 1013/1261 [04:24<01:04,  3.86it/s]
40.4221321242
12.3327195533
failed sanity: line distance from previous detection
 80%|████████  | 1014/1261 [04:24<01:04,  3.84it/s]
30.8960305809
11.6938624063
failed sanity: line distance from previous detection
 80%|████████  | 1015/1261 [04:24<01:04,  3.80it/s]
32.5981433935
9.09933565699
failed sanity: line distance from previous detection
 81%|████████  | 1016/1261 [04:25<01:05,  3.76it/s]
31.4845877586
0.546884241512
failed sanity: line distance from previous detection
 81%|████████  | 1017/1261 [04:25<01:04,  3.75it/s]
35.7662521276
7.25076585699
failed sanity: line distance from previous detection
 81%|████████  | 1018/1261 [04:25<01:05,  3.70it/s]
42.780721121
12.5570245674
failed sanity: line distance from previous detection
 81%|████████  | 1019/1261 [04:25<01:05,  3.72it/s]
46.6017373555
13.8347360448
failed sanity: line distance from previous detection
 81%|████████  | 1020/1261 [04:26<01:04,  3.75it/s]
29.7966742443
10.5432849964
failed sanity: line distance from previous detection
 81%|████████  | 1021/1261 [04:26<01:04,  3.73it/s]
32.1896673328
23.1898374234
failed sanity: line distance from previous detection
 81%|████████  | 1022/1261 [04:26<01:04,  3.68it/s]
34.8625707955
21.5951886915
failed sanity: line distance from previous detection
 81%|████████  | 1023/1261 [04:27<01:04,  3.71it/s]
36.270370158
21.2312952657
failed sanity: line distance from previous detection
 81%|████████  | 1024/1261 [04:27<01:03,  3.74it/s]
41.84508023
20.6872307448
failed sanity: line distance from previous detection
 81%|████████▏ | 1025/1261 [04:27<01:02,  3.76it/s]
41.6319259308
15.5518646965
failed sanity: line distance from previous detection
 81%|████████▏ | 1026/1261 [04:27<01:03,  3.72it/s]
42.6368252666
16.8196766156
failed sanity: line distance from previous detection
 81%|████████▏ | 1027/1261 [04:28<01:02,  3.72it/s]
46.4320255746
44.8153839871
failed sanity: line distance from previous detection
 82%|████████▏ | 1028/1261 [04:28<01:02,  3.75it/s]
45.4135763093
73.6304869262
failed sanity: line distance from previous detection
 82%|████████▏ | 1029/1261 [04:28<01:01,  3.74it/s]
40.984579713
7.60636450935
failed sanity: line distance from previous detection
 82%|████████▏ | 1030/1261 [04:28<01:02,  3.70it/s]
50.7333220727
0.834791950625
failed sanity: line distance from previous detection
 82%|████████▏ | 1031/1261 [04:29<01:02,  3.70it/s]
49.3326280174
18.7670729235
failed sanity: line distance from previous detection
 82%|████████▏ | 1032/1261 [04:29<01:01,  3.74it/s]
48.3908057565
23.7330692843
failed sanity: line distance from previous detection
 82%|████████▏ | 1033/1261 [04:29<01:00,  3.77it/s]
48.0767849301
16.4837124253
failed sanity: line distance from previous detection
 82%|████████▏ | 1034/1261 [04:29<01:00,  3.74it/s]
55.3287234349
20.1917845243
failed sanity: line distance from previous detection
 82%|████████▏ | 1035/1261 [04:30<01:00,  3.75it/s]
57.0281372461
22.0652815783
failed sanity: line distance from previous detection
 82%|████████▏ | 1036/1261 [04:30<00:59,  3.79it/s]
60.6044045338
25.4065441373
failed sanity: line distance from previous detection
 82%|████████▏ | 1037/1261 [04:30<00:59,  3.77it/s]
56.2013012231
21.4940158727
failed sanity: line distance from previous detection
 82%|████████▏ | 1038/1261 [04:31<01:00,  3.68it/s]
55.0882197053
29.0698350351
failed sanity: line distance from previous detection
 82%|████████▏ | 1039/1261 [04:31<00:59,  3.71it/s]
45.2648770856
18.9214533384
failed sanity: line distance from previous detection
 82%|████████▏ | 1040/1261 [04:31<00:59,  3.73it/s]
45.581226587
49.6117903241
failed sanity: line distance from previous detection
 83%|████████▎ | 1041/1261 [04:31<00:58,  3.76it/s]
51.3066116107
82.850610078
failed sanity: line distance from previous detection
 83%|████████▎ | 1042/1261 [04:32<00:58,  3.75it/s]
44.665998346
32.9165044593
failed sanity: line distance from previous detection
 83%|████████▎ | 1043/1261 [04:32<00:58,  3.72it/s]
35.5945991762
17.2750936671
failed sanity: line distance from previous detection
 83%|████████▎ | 1051/1261 [04:34<00:54,  3.84it/s]
28.162906495
30.0794516455
failed sanity: line distance from previous detection
 83%|████████▎ | 1052/1261 [04:34<00:55,  3.75it/s]
29.6733660636
27.8645551028
failed sanity: line distance from previous detection
 84%|████████▎ | 1053/1261 [04:34<00:54,  3.78it/s]
32.7894055937
19.2496610314
failed sanity: line distance from previous detection
 84%|████████▎ | 1054/1261 [04:35<00:54,  3.80it/s]
29.9317648152
7.29819402951
failed sanity: line distance from previous detection
 84%|████████▎ | 1055/1261 [04:35<00:53,  3.82it/s]
28.7268463798
1.3031159468
failed sanity: line distance from previous detection
 84%|████████▎ | 1056/1261 [04:35<00:54,  3.76it/s]
26.8539930944
5.74659202932
failed sanity: line distance from previous detection
 84%|████████▍ | 1061/1261 [04:37<00:51,  3.87it/s]
25.7985866193
6.08985286273
failed sanity: line distance from previous detection
 84%|████████▍ | 1062/1261 [04:37<00:50,  3.93it/s]
31.4319830828
10.8367370575
failed sanity: line distance from previous detection
 84%|████████▍ | 1063/1261 [04:37<00:50,  3.92it/s]
32.3180930924
11.4391503506
failed sanity: line distance from previous detection
 85%|████████▍ | 1066/1261 [04:38<00:50,  3.87it/s]
80056.5330053
failed sanity: radius diff
 85%|████████▌ | 1072/1261 [04:39<00:49,  3.81it/s]
4.09179066476
41.2040790301
failed sanity: line distance from previous detection
 85%|████████▌ | 1075/1261 [04:40<00:48,  3.84it/s]
9634.30376125
failed sanity: radius diff
 86%|████████▌ | 1084/1261 [04:43<00:46,  3.77it/s]
7.79306001716
31.3992010399
failed sanity: line distance from previous detection
 86%|████████▌ | 1085/1261 [04:43<00:46,  3.81it/s]
9.81266092074
27.2542291334
failed sanity: line distance from previous detection
 86%|████████▋ | 1090/1261 [04:44<00:45,  3.80it/s]
7134.36569566
failed sanity: radius diff
 87%|████████▋ | 1095/1261 [04:45<00:43,  3.77it/s]
13546.8642894
failed sanity: radius diff
 88%|████████▊ | 1107/1261 [04:49<00:42,  3.64it/s]
0.76174931366
50.3671377764
failed sanity: line distance from previous detection
 88%|████████▊ | 1108/1261 [04:49<00:41,  3.68it/s]
0.988829985819
35.7665151855
failed sanity: line distance from previous detection
 88%|████████▊ | 1109/1261 [04:49<00:41,  3.69it/s]
0.249728113858
31.6056269417
failed sanity: line distance from previous detection
 90%|████████▉ | 1129/1261 [04:55<00:37,  3.55it/s]
0.0437787167114
27.8711491514
failed sanity: line distance from previous detection
 90%|████████▉ | 1130/1261 [04:55<00:38,  3.40it/s]
1.26338840247
25.8031950375
failed sanity: line distance from previous detection
 90%|█████████ | 1141/1261 [04:58<00:36,  3.30it/s]
2.71691666632
26.6390641077
failed sanity: line distance from previous detection
 91%|█████████ | 1149/1261 [05:01<00:33,  3.37it/s]
5701.4530808
failed sanity: radius diff
 91%|█████████ | 1150/1261 [05:01<00:34,  3.23it/s]
27211.5471203
failed sanity: radius diff
 91%|█████████▏| 1152/1261 [05:02<00:32,  3.35it/s]
5544.65419434
failed sanity: radius diff
 91%|█████████▏| 1153/1261 [05:02<00:31,  3.48it/s]
6041.10754755
failed sanity: radius diff
 92%|█████████▏| 1155/1261 [05:02<00:31,  3.42it/s]
31267.2930014
failed sanity: radius diff
 94%|█████████▍| 1186/1261 [05:11<00:19,  3.85it/s]
2.8082846176
39.8154991259
failed sanity: line distance from previous detection
 97%|█████████▋| 1220/1261 [05:20<00:11,  3.63it/s]
2.95818355874
30.5275917764
failed sanity: line distance from previous detection
 98%|█████████▊| 1233/1261 [05:23<00:07,  3.60it/s]
3.00158975463
26.1740476136
failed sanity: line distance from previous detection
 98%|█████████▊| 1239/1261 [05:25<00:05,  3.81it/s]
15086.2125053
failed sanity: radius diff
 98%|█████████▊| 1242/1261 [05:25<00:04,  3.80it/s]
3.19678810134
35.4271397334
failed sanity: line distance from previous detection
 99%|█████████▊| 1243/1261 [05:26<00:04,  3.81it/s]
2.37108746527
37.0882631699
failed sanity: line distance from previous detection
 99%|█████████▉| 1247/1261 [05:27<00:03,  3.86it/s]
85248.5230965
failed sanity: radius diff
 99%|█████████▉| 1250/1261 [05:28<00:02,  3.79it/s]
9141.46047719
failed sanity: radius diff
 99%|█████████▉| 1253/1261 [05:28<00:02,  3.87it/s]
3.36823430033
25.2206097066
failed sanity: line distance from previous detection
100%|█████████▉| 1257/1261 [05:29<00:01,  3.93it/s]
4017.88249051
failed sanity: radius diff
100%|█████████▉| 1258/1261 [05:30<00:00,  3.88it/s]
148178.949966
failed sanity: radius diff
100%|█████████▉| 1259/1261 [05:30<00:00,  3.91it/s]
38814.7018919
failed sanity: radius diff
100%|█████████▉| 1260/1261 [05:30<00:00,  3.91it/s]
[MoviePy] Done.
[MoviePy] >>>> Video ready: ./processed_project_video.mp4 

CPU times: user 5min 49s, sys: 1min 13s, total: 7min 2s
Wall time: 5min 31s
In [28]:
output = out_dir+'processed_challenge_video.mp4'
left_fit_prev = right_fit_prev = None
frame_count = 0
left, right = Line(), Line()
clip = VideoFileClip("challenge_video.mp4")
out_clip = clip.fl_image(process_image_in_video) 
out_clip.write_videofile(output, audio=False)
first frame
[MoviePy] >>>> Building video ./processed_challenge_video.mp4
[MoviePy] Writing video ./processed_challenge_video.mp4
  0%|          | 1/485 [00:00<02:21,  3.41it/s]
first frame
  1%|          | 6/485 [00:01<02:01,  3.94it/s]
27.7658878585
42.5283973016
failed sanity: line distance from previous detection
  1%|▏         | 7/485 [00:01<02:10,  3.68it/s]
24.9740281583
42.5283973016
failed sanity: line distance from previous detection
  2%|▏         | 8/485 [00:02<02:05,  3.81it/s]
17.4919023391
43.0283973016
failed sanity: line distance from previous detection
  2%|▏         | 10/485 [00:02<02:05,  3.78it/s]
31.0563232478
44.2586666105
failed sanity: line distance from previous detection
  5%|▍         | 23/485 [00:06<02:10,  3.53it/s]
199.722203337
627.738059966
failed sanity: left and right line coefficient
  5%|▍         | 24/485 [00:06<02:12,  3.49it/s]
2.5451184549
628.07137903
failed sanity: left and right line coefficient
  5%|▌         | 25/485 [00:06<02:17,  3.34it/s]
17.0905225974
32.3039420141
failed sanity: line distance from previous detection
  6%|▋         | 31/485 [00:08<02:02,  3.70it/s]
20.6674591967
43.1122991557
failed sanity: line distance from previous detection
  7%|▋         | 32/485 [00:08<02:00,  3.75it/s]
20.3758111988
2191.91328031
failed sanity: line distance from previous detection
  7%|▋         | 33/485 [00:08<02:06,  3.57it/s]
6654.41203134
failed sanity: radius diff
  7%|▋         | 34/485 [00:09<02:07,  3.53it/s]
21.1745103536
31.3731253432
failed sanity: line distance from previous detection
  7%|▋         | 35/485 [00:09<02:02,  3.66it/s]
21.4803045789
31.1837545017
failed sanity: line distance from previous detection
  7%|▋         | 36/485 [00:09<02:05,  3.58it/s]
21.9958455745
650.193142232
failed sanity: line distance from previous detection
  8%|▊         | 37/485 [00:10<02:07,  3.51it/s]
241.309363073
84.0159718021
failed sanity: left and right line coefficient
  8%|▊         | 38/485 [00:10<02:09,  3.46it/s]
224.956465481
78.00831922
failed sanity: left and right line coefficient
  8%|▊         | 39/485 [00:10<02:10,  3.42it/s]
1.99099022096
failed sanity: left and right line curvature
  8%|▊         | 40/485 [00:10<02:11,  3.38it/s]
2.27051354907
failed sanity: left and right line curvature
  8%|▊         | 41/485 [00:11<02:10,  3.41it/s]
14.5962206875
34.2297479775
failed sanity: line distance from previous detection
  9%|▉         | 43/485 [00:11<01:57,  3.76it/s]
190.836426714
641.071365718
failed sanity: left and right line coefficient
  9%|▉         | 44/485 [00:11<01:57,  3.75it/s]
1.51137467594
failed sanity: left and right line curvature
  9%|▉         | 45/485 [00:12<01:53,  3.89it/s]
265.683441137
642.738028447
failed sanity: left and right line coefficient
 10%|▉         | 48/485 [00:12<01:45,  4.13it/s]
7.26351770005
71.2807145785
failed sanity: line distance from previous detection
 11%|█         | 53/485 [00:14<01:41,  4.27it/s]
2.13054833827
127.930445952
failed sanity: line distance from previous detection
 12%|█▏        | 56/485 [00:14<01:39,  4.29it/s]
0.202683788731
127.435149265
failed sanity: line distance from previous detection
 12%|█▏        | 57/485 [00:15<01:40,  4.27it/s]
234.647163176
15.4803528683
failed sanity: left and right line coefficient
 12%|█▏        | 58/485 [00:15<01:39,  4.29it/s]
2.48543016947
209.297970548
failed sanity: line distance from previous detection
 12%|█▏        | 59/485 [00:15<01:39,  4.26it/s]
4.53182094853
302.487202483
failed sanity: line distance from previous detection
 12%|█▏        | 60/485 [00:15<01:41,  4.17it/s]
1.24732358007
71.2333062339
failed sanity: line distance from previous detection
 13%|█▎        | 61/485 [00:15<01:41,  4.18it/s]
301.180223075
111.986491972
failed sanity: left and right line coefficient
 13%|█▎        | 62/485 [00:16<01:41,  4.19it/s]
10.5128237221
26.3532476154
failed sanity: line distance from previous detection
 13%|█▎        | 63/485 [00:16<01:40,  4.20it/s]
5.93384126943
97.9763097227
failed sanity: line distance from previous detection
 13%|█▎        | 64/485 [00:16<01:42,  4.09it/s]
18.6139548596
34.0658503588
failed sanity: line distance from previous detection
 13%|█▎        | 65/485 [00:16<01:41,  4.13it/s]
305.048189754
57.0160382901
failed sanity: left and right line coefficient
 14%|█▍        | 67/485 [00:17<01:39,  4.20it/s]
328.239270863
600.292946053
failed sanity: left and right line coefficient
 14%|█▍        | 68/485 [00:17<01:41,  4.10it/s]
27.1821615162
224.812614086
failed sanity: line distance from previous detection
 15%|█▍        | 71/485 [00:18<01:36,  4.28it/s]
21.5109129465
87.4707755071
failed sanity: line distance from previous detection
 15%|█▍        | 72/485 [00:18<01:37,  4.22it/s]
21.476089277
28.7561629597
failed sanity: line distance from previous detection
 15%|█▌        | 73/485 [00:18<01:37,  4.24it/s]
failed sanity: line distance from center
 15%|█▌        | 74/485 [00:19<01:36,  4.25it/s]
20.9289716249
397.755967275
failed sanity: line distance from previous detection
 16%|█▌        | 77/485 [00:19<01:38,  4.16it/s]
failed sanity: line distance from center
 21%|██        | 101/485 [00:26<02:06,  3.05it/s]
177.895780481
586.400713539
failed sanity: left and right line coefficient
 21%|██        | 102/485 [00:27<02:05,  3.04it/s]
8.82451771867
28.7699261815
failed sanity: line distance from previous detection
 22%|██▏       | 106/485 [00:28<01:48,  3.51it/s]
15.604681719
49.6327704117
failed sanity: line distance from previous detection
 23%|██▎       | 110/485 [00:29<01:38,  3.80it/s]
1.4141382614
failed sanity: left and right line curvature
 23%|██▎       | 112/485 [00:29<01:36,  3.85it/s]
1.36011562825
failed sanity: left and right line curvature
 24%|██▎       | 114/485 [00:30<01:30,  4.09it/s]
1.39080411952
172.088883706
failed sanity: line distance from previous detection
 24%|██▍       | 116/485 [00:30<01:41,  3.62it/s]
1.71343047277
82.2588132315
failed sanity: line distance from previous detection
 24%|██▍       | 117/485 [00:31<01:38,  3.75it/s]
1.53518492318
failed sanity: left and right line curvature
 24%|██▍       | 118/485 [00:31<01:39,  3.68it/s]
10.2304137488
138.987998631
failed sanity: line distance from previous detection
 25%|██▍       | 119/485 [00:31<01:42,  3.58it/s]
13.8282749095
282.927191737
failed sanity: line distance from previous detection
 25%|██▍       | 120/485 [00:31<01:38,  3.69it/s]
2.51040743989
failed sanity: left and right line curvature
 25%|██▍       | 121/485 [00:32<01:37,  3.73it/s]
1.88126586808
failed sanity: left and right line curvature
 25%|██▌       | 122/485 [00:32<01:38,  3.69it/s]
2.18208446697
failed sanity: left and right line curvature
 25%|██▌       | 123/485 [00:32<01:37,  3.73it/s]
1.3846497177
failed sanity: left and right line curvature
 26%|██▌       | 124/485 [00:32<01:34,  3.81it/s]
12.9252773549
95.5430266901
failed sanity: line distance from previous detection
 26%|██▌       | 125/485 [00:33<01:41,  3.56it/s]
19.1897779031
97.9440078491
failed sanity: line distance from previous detection
 26%|██▌       | 126/485 [00:33<01:47,  3.35it/s]
1.84177131312
failed sanity: left and right line curvature
 26%|██▌       | 127/485 [00:33<01:41,  3.53it/s]
2.56555072926
failed sanity: left and right line curvature
 26%|██▋       | 128/485 [00:34<01:37,  3.67it/s]
4.86312239313
failed sanity: left and right line curvature
 27%|██▋       | 129/485 [00:34<01:35,  3.71it/s]
19.9233766334
84.1137294428
failed sanity: line distance from previous detection
 27%|██▋       | 130/485 [00:34<01:35,  3.73it/s]
1.65610942521
failed sanity: left and right line curvature
 27%|██▋       | 131/485 [00:34<01:33,  3.79it/s]
1.96621435398
failed sanity: left and right line curvature
 27%|██▋       | 132/485 [00:35<01:31,  3.88it/s]
1.99806297559
failed sanity: left and right line curvature
 27%|██▋       | 133/485 [00:35<01:29,  3.93it/s]
1.99217681566
failed sanity: left and right line curvature
 28%|██▊       | 134/485 [00:35<01:30,  3.87it/s]
73.1864733017
582.400724051
failed sanity: left and right line coefficient
 28%|██▊       | 135/485 [00:35<01:28,  3.96it/s]
62.2685567146
583.234048887
failed sanity: left and right line coefficient
 28%|██▊       | 136/485 [00:36<01:26,  4.02it/s]
20.8229329694
160.50261198
failed sanity: line distance from previous detection
 28%|██▊       | 137/485 [00:36<01:26,  4.01it/s]
1.88412400881
failed sanity: left and right line curvature
 29%|██▊       | 139/485 [00:36<01:25,  4.05it/s]
97.3654577216
416.181299119
failed sanity: left and right line coefficient
 29%|██▉       | 140/485 [00:37<01:24,  4.09it/s]
1.58834535854
failed sanity: left and right line curvature
 29%|██▉       | 141/485 [00:37<01:25,  4.02it/s]
252.409041332
1342.21738721
failed sanity: left and right line coefficient
 29%|██▉       | 142/485 [00:37<01:25,  4.02it/s]
248.382033452
2181.56274538
failed sanity: left and right line coefficient
 29%|██▉       | 143/485 [00:37<01:25,  4.01it/s]
32.0026782588
49.1706008576
failed sanity: line distance from previous detection
 30%|██▉       | 144/485 [00:38<01:23,  4.08it/s]
26.3891053583
2.18608560173
failed sanity: line distance from previous detection
 30%|██▉       | 145/485 [00:38<01:22,  4.12it/s]
2.43157328672
failed sanity: left and right line curvature
 30%|███       | 146/485 [00:38<01:22,  4.08it/s]
4.59083817541
failed sanity: left and right line curvature
 30%|███       | 147/485 [00:38<01:22,  4.08it/s]
10.402443494
164.884690598
failed sanity: line distance from previous detection
 31%|███       | 148/485 [00:39<01:22,  4.09it/s]
1.65244127752
failed sanity: left and right line curvature
 31%|███       | 149/485 [00:39<01:23,  4.04it/s]
2.21994098065
failed sanity: left and right line curvature
 31%|███       | 150/485 [00:39<01:25,  3.92it/s]
2.29696443551
failed sanity: left and right line curvature
 31%|███       | 151/485 [00:39<01:24,  3.94it/s]
3.20713985461
26.0616831698
failed sanity: line distance from previous detection
 31%|███▏      | 152/485 [00:40<01:29,  3.73it/s]
47.6984245371
1050.31705347
failed sanity: left and right line coefficient
 32%|███▏      | 153/485 [00:40<01:28,  3.76it/s]
3.06157615228
25.6253155321
failed sanity: line distance from previous detection
 32%|███▏      | 154/485 [00:40<01:40,  3.30it/s]
3.3186594061
51.1451343745
failed sanity: line distance from previous detection
 32%|███▏      | 155/485 [00:41<01:36,  3.40it/s]
1.3535710974
failed sanity: left and right line curvature
 32%|███▏      | 156/485 [00:41<01:34,  3.46it/s]
1.14752988182
66.9873099583
failed sanity: line distance from previous detection
 32%|███▏      | 157/485 [00:41<01:37,  3.37it/s]
2.19290901701
64.2344252267
failed sanity: line distance from previous detection
 33%|███▎      | 158/485 [00:42<01:40,  3.24it/s]
0.986612775639
80.1353294686
failed sanity: line distance from previous detection
 33%|███▎      | 159/485 [00:42<01:39,  3.27it/s]
4.69608641806
82.4179642985
failed sanity: line distance from previous detection
 33%|███▎      | 160/485 [00:42<01:39,  3.26it/s]
7.28739192043
95.2526809265
failed sanity: line distance from previous detection
 33%|███▎      | 161/485 [00:42<01:38,  3.29it/s]
2.27584787449
failed sanity: left and right line curvature
 33%|███▎      | 162/485 [00:43<01:40,  3.23it/s]
0.355093985795
109.883296354
failed sanity: line distance from previous detection
 34%|███▎      | 163/485 [00:43<01:43,  3.11it/s]
1.30763729116
failed sanity: left and right line curvature
 34%|███▍      | 164/485 [00:44<01:48,  2.96it/s]
2.28198201718
failed sanity: left and right line curvature
 34%|███▍      | 165/485 [00:44<01:42,  3.12it/s]
22.541322616
failed sanity: left and right line curvature
 34%|███▍      | 166/485 [00:44<01:37,  3.27it/s]
1.94294958313
86.0213520137
failed sanity: line distance from previous detection
 34%|███▍      | 167/485 [00:44<01:37,  3.26it/s]
1.86204548871
failed sanity: left and right line curvature
 35%|███▍      | 168/485 [00:45<01:36,  3.27it/s]
1.87920292825
failed sanity: left and right line curvature
 35%|███▍      | 169/485 [00:45<01:32,  3.41it/s]
2.91084964843
108.792014291
failed sanity: line distance from previous detection
 35%|███▌      | 170/485 [00:45<01:30,  3.50it/s]
2.23230900941
failed sanity: left and right line curvature
 35%|███▌      | 171/485 [00:45<01:29,  3.50it/s]
7.61063527056
91.8401315551
failed sanity: line distance from previous detection
 35%|███▌      | 172/485 [00:46<01:31,  3.43it/s]
7.69162642677
98.4512257457
failed sanity: line distance from previous detection
 36%|███▌      | 173/485 [00:46<01:26,  3.60it/s]
1.97473637708
failed sanity: left and right line curvature
 36%|███▌      | 174/485 [00:46<01:27,  3.56it/s]
2.92473709343
82.8291343781
failed sanity: line distance from previous detection
 37%|███▋      | 181/485 [00:48<01:12,  4.21it/s]
1.99247923895
failed sanity: left and right line curvature
 38%|███▊      | 182/485 [00:48<01:14,  4.06it/s]
31.5695383367
47.2134924291
failed sanity: line distance from previous detection
 38%|███▊      | 183/485 [00:48<01:13,  4.10it/s]
1.96150453838
failed sanity: left and right line curvature
 38%|███▊      | 184/485 [00:49<01:12,  4.14it/s]
30.8541982196
62.7243939115
failed sanity: line distance from previous detection
 38%|███▊      | 185/485 [00:49<01:12,  4.13it/s]
27.2140188532
155.615654622
failed sanity: line distance from previous detection
 38%|███▊      | 186/485 [00:49<01:13,  4.04it/s]
28.571806255
67.9422870385
failed sanity: line distance from previous detection
 39%|███▊      | 187/485 [00:49<01:13,  4.06it/s]
23.8722369161
65.8221402424
failed sanity: line distance from previous detection
 41%|████      | 198/485 [00:52<01:04,  4.46it/s]
22.1848847712
56.0807199949
failed sanity: line distance from previous detection
 48%|████▊     | 232/485 [01:00<01:00,  4.19it/s]
25.8282324361
938.116205899
failed sanity: line distance from previous detection
 61%|██████    | 295/485 [01:16<00:44,  4.24it/s]
19.3417571407
34.0
failed sanity: line distance from previous detection
 61%|██████    | 297/485 [01:16<00:43,  4.30it/s]
25.9546049439
41.9156987195
failed sanity: line distance from previous detection
 62%|██████▏   | 299/485 [01:16<00:43,  4.32it/s]
29.6719127766
43.918485528
failed sanity: line distance from previous detection
 62%|██████▏   | 300/485 [01:17<00:42,  4.32it/s]
30.9688122329
44.4191822301
failed sanity: line distance from previous detection
 63%|██████▎   | 307/485 [01:18<00:40,  4.41it/s]
26.7960459589
26.8947976557
failed sanity: line distance from previous detection
 74%|███████▍  | 359/485 [01:31<00:29,  4.20it/s]
27.5898609991
27.7470885579
failed sanity: line distance from previous detection
 74%|███████▍  | 360/485 [01:31<00:30,  4.12it/s]
310.934706517
518.750262448
failed sanity: left and right line coefficient
 75%|███████▍  | 362/485 [01:31<00:30,  4.03it/s]
27.9269510646
22.5554262373
failed sanity: line distance from previous detection
 75%|███████▌  | 364/485 [01:32<00:29,  4.04it/s]
28.8681910477
340.486183733
failed sanity: line distance from previous detection
 76%|███████▌  | 369/485 [01:33<00:28,  4.09it/s]
1.69402162117
failed sanity: left and right line curvature
 76%|███████▋  | 370/485 [01:33<00:28,  4.02it/s]
1.84420187442
failed sanity: left and right line curvature
 78%|███████▊  | 380/485 [01:36<00:25,  4.16it/s]
30.1779911736
65.185191779
failed sanity: line distance from previous detection
 82%|████████▏ | 396/485 [01:40<00:20,  4.41it/s]
44.1650867008
10.8725031877
failed sanity: line distance from previous detection
 82%|████████▏ | 397/485 [01:40<00:20,  4.33it/s]
39.7734666385
258.879927842
failed sanity: line distance from previous detection
 82%|████████▏ | 398/485 [01:40<00:20,  4.27it/s]
35.0183104138
77.5578373859
failed sanity: line distance from previous detection
 82%|████████▏ | 399/485 [01:40<00:20,  4.22it/s]
36.9584141716
57.4372964854
failed sanity: line distance from previous detection
 82%|████████▏ | 400/485 [01:41<00:20,  4.18it/s]
33.6378486632
39.912911911
failed sanity: line distance from previous detection
 83%|████████▎ | 401/485 [01:41<00:20,  4.19it/s]
2.16096299684
failed sanity: left and right line curvature
 83%|████████▎ | 402/485 [01:41<00:19,  4.21it/s]
61.1411120765
failed sanity: left and right line curvature
 83%|████████▎ | 403/485 [01:41<00:19,  4.19it/s]
1.5415662399
failed sanity: left and right line curvature
 83%|████████▎ | 404/485 [01:41<00:19,  4.20it/s]
1.97574027871
failed sanity: left and right line curvature
 84%|████████▎ | 405/485 [01:42<00:18,  4.22it/s]
1.92254509113
failed sanity: left and right line curvature
 84%|████████▎ | 406/485 [01:42<00:18,  4.25it/s]
2.06597298622
failed sanity: left and right line curvature
 84%|████████▍ | 407/485 [01:42<00:18,  4.16it/s]
2.00163113358
failed sanity: left and right line curvature
 84%|████████▍ | 408/485 [01:42<00:18,  4.20it/s]
2.03806687457
failed sanity: left and right line curvature
 84%|████████▍ | 409/485 [01:43<00:17,  4.24it/s]
2.48632337068
failed sanity: left and right line curvature
 85%|████████▍ | 410/485 [01:43<00:17,  4.27it/s]
1.97210746677
failed sanity: left and right line curvature
 85%|████████▍ | 411/485 [01:43<00:17,  4.24it/s]
2.01200672603
failed sanity: left and right line curvature
 85%|████████▍ | 412/485 [01:43<00:17,  4.16it/s]
1.97320221129
failed sanity: left and right line curvature
 85%|████████▌ | 413/485 [01:44<00:17,  4.22it/s]
1.83538793079
failed sanity: left and right line curvature
 85%|████████▌ | 414/485 [01:44<00:16,  4.24it/s]
2.12286744508
failed sanity: left and right line curvature
 86%|████████▌ | 415/485 [01:44<00:16,  4.18it/s]
1.95221283648
failed sanity: left and right line curvature
 86%|████████▌ | 416/485 [01:44<00:16,  4.17it/s]
1.81889971524
failed sanity: left and right line curvature
 86%|████████▌ | 417/485 [01:45<00:16,  4.04it/s]
1.98074912017
failed sanity: left and right line curvature
 86%|████████▌ | 418/485 [01:45<00:16,  4.06it/s]
2.03541970527
failed sanity: left and right line curvature
 86%|████████▋ | 419/485 [01:45<00:16,  4.08it/s]
1.96191190485
failed sanity: left and right line curvature
 87%|████████▋ | 420/485 [01:45<00:15,  4.10it/s]
1.98527493965
failed sanity: left and right line curvature
 87%|████████▋ | 421/485 [01:46<00:15,  4.12it/s]
1.97760041537
failed sanity: left and right line curvature
 87%|████████▋ | 422/485 [01:46<00:15,  4.18it/s]
1.97361891349
failed sanity: left and right line curvature
 87%|████████▋ | 423/485 [01:46<00:15,  3.99it/s]
1.97293118694
failed sanity: left and right line curvature
 87%|████████▋ | 424/485 [01:46<00:14,  4.08it/s]
1.97780614452
failed sanity: left and right line curvature
 88%|████████▊ | 425/485 [01:47<00:14,  4.16it/s]
1.97783878612
failed sanity: left and right line curvature
 88%|████████▊ | 426/485 [01:47<00:14,  4.17it/s]
1.97404280544
failed sanity: left and right line curvature
 88%|████████▊ | 427/485 [01:47<00:14,  4.13it/s]
2.59756501425
failed sanity: left and right line curvature
 88%|████████▊ | 428/485 [01:47<00:13,  4.16it/s]
1.96882460156
failed sanity: left and right line curvature
 88%|████████▊ | 429/485 [01:47<00:13,  4.20it/s]
1.96183675053
failed sanity: left and right line curvature
 89%|████████▊ | 430/485 [01:48<00:12,  4.25it/s]
1.9218961465
failed sanity: left and right line curvature
 89%|████████▉ | 431/485 [01:48<00:12,  4.23it/s]
1.94572203981
failed sanity: left and right line curvature
 89%|████████▉ | 432/485 [01:48<00:12,  4.24it/s]
1.94949404778
failed sanity: left and right line curvature
 89%|████████▉ | 433/485 [01:48<00:12,  4.23it/s]
1.67207445837
failed sanity: left and right line curvature
 89%|████████▉ | 434/485 [01:49<00:12,  4.24it/s]
1.6662750994
failed sanity: left and right line curvature
 90%|████████▉ | 435/485 [01:49<00:11,  4.19it/s]
2.04859612947
failed sanity: left and right line curvature
 90%|████████▉ | 436/485 [01:49<00:11,  4.21it/s]
1.87215570092
failed sanity: left and right line curvature
 90%|█████████ | 437/485 [01:49<00:11,  4.24it/s]
1.90849560815
failed sanity: left and right line curvature
 90%|█████████ | 438/485 [01:50<00:11,  4.24it/s]
1.89042730373
failed sanity: left and right line curvature
 91%|█████████ | 439/485 [01:50<00:10,  4.23it/s]
1.92738466204
failed sanity: left and right line curvature
 91%|█████████ | 440/485 [01:50<00:10,  4.21it/s]
2.0663351196
failed sanity: left and right line curvature
 91%|█████████ | 441/485 [01:50<00:10,  4.21it/s]
2.66989961228
failed sanity: left and right line curvature
 91%|█████████ | 442/485 [01:51<00:10,  4.20it/s]
2.44933502287
failed sanity: left and right line curvature
 91%|█████████▏| 443/485 [01:51<00:10,  4.17it/s]
2.20058267112
failed sanity: left and right line curvature
 92%|█████████▏| 444/485 [01:51<00:09,  4.19it/s]
2.08386371136
failed sanity: left and right line curvature
 92%|█████████▏| 445/485 [01:51<00:09,  4.22it/s]
2.15428968616
failed sanity: left and right line curvature
 92%|█████████▏| 446/485 [01:52<00:09,  4.18it/s]
2.13716080492
failed sanity: left and right line curvature
 92%|█████████▏| 447/485 [01:52<00:09,  4.19it/s]
1.95786298428
failed sanity: left and right line curvature
 92%|█████████▏| 448/485 [01:52<00:08,  4.20it/s]
1.92027879523
failed sanity: left and right line curvature
 93%|█████████▎| 449/485 [01:52<00:08,  4.22it/s]
1.97458982143
failed sanity: left and right line curvature
 93%|█████████▎| 450/485 [01:52<00:08,  4.20it/s]
1.94670776754
failed sanity: left and right line curvature
 93%|█████████▎| 451/485 [01:53<00:08,  4.21it/s]
1.94062933648
failed sanity: left and right line curvature
 93%|█████████▎| 452/485 [01:53<00:07,  4.20it/s]
1.76481798443
failed sanity: left and right line curvature
 93%|█████████▎| 453/485 [01:53<00:07,  4.21it/s]
5.00348364225
failed sanity: left and right line curvature
 94%|█████████▎| 454/485 [01:53<00:07,  4.09it/s]
23.7803162283
failed sanity: left and right line curvature
 94%|█████████▍| 455/485 [01:54<00:07,  4.10it/s]
2.58781940462
failed sanity: left and right line curvature
 94%|█████████▍| 456/485 [01:54<00:06,  4.14it/s]
2.39234472617
failed sanity: left and right line curvature
 94%|█████████▍| 457/485 [01:54<00:06,  4.20it/s]
2.50629989076
failed sanity: left and right line curvature
 94%|█████████▍| 458/485 [01:54<00:06,  4.18it/s]
3.04132034126
failed sanity: left and right line curvature
 95%|█████████▍| 459/485 [01:55<00:06,  4.15it/s]
3.15601746472
failed sanity: left and right line curvature
 95%|█████████▍| 460/485 [01:55<00:05,  4.17it/s]
1.53309639033
failed sanity: left and right line curvature
 95%|█████████▌| 461/485 [01:55<00:05,  4.18it/s]
1.94270148629
failed sanity: left and right line curvature
 95%|█████████▌| 462/485 [01:55<00:05,  4.14it/s]
1.97501825318
failed sanity: left and right line curvature
 95%|█████████▌| 463/485 [01:56<00:05,  4.16it/s]
1.96655191451
failed sanity: left and right line curvature
 96%|█████████▌| 464/485 [01:56<00:05,  4.19it/s]
1.95997758992
failed sanity: left and right line curvature
 96%|█████████▌| 465/485 [01:56<00:04,  4.06it/s]
1.95639578588
failed sanity: left and right line curvature
 96%|█████████▌| 466/485 [01:56<00:04,  3.86it/s]
1.96278456555
failed sanity: left and right line curvature
 96%|█████████▋| 467/485 [01:57<00:04,  3.62it/s]
1.95957001576
failed sanity: left and right line curvature
 96%|█████████▋| 468/485 [01:57<00:04,  3.53it/s]
1.95865461697
failed sanity: left and right line curvature
 97%|█████████▋| 469/485 [01:57<00:04,  3.58it/s]
1.96523834853
failed sanity: left and right line curvature
 97%|█████████▋| 470/485 [01:58<00:04,  3.58it/s]
2.64104885541
failed sanity: left and right line curvature
 97%|█████████▋| 471/485 [01:58<00:04,  3.34it/s]
2.31447627877
failed sanity: left and right line curvature
 97%|█████████▋| 472/485 [01:58<00:03,  3.49it/s]
2.88602424736
failed sanity: left and right line curvature
 98%|█████████▊| 473/485 [01:58<00:03,  3.58it/s]
1.94395563443
failed sanity: left and right line curvature
 98%|█████████▊| 474/485 [01:59<00:03,  3.53it/s]
4.54479873847
failed sanity: left and right line curvature
 98%|█████████▊| 475/485 [01:59<00:02,  3.62it/s]
1.91816584349
failed sanity: left and right line curvature
 98%|█████████▊| 476/485 [01:59<00:02,  3.67it/s]
1.92350680685
failed sanity: left and right line curvature
 98%|█████████▊| 477/485 [02:00<00:02,  3.68it/s]
1.95696045192
failed sanity: left and right line curvature
 99%|█████████▊| 478/485 [02:00<00:02,  3.45it/s]
1.9464760169
failed sanity: left and right line curvature
 99%|█████████▉| 479/485 [02:00<00:01,  3.52it/s]
1.93426496011
failed sanity: left and right line curvature
 99%|█████████▉| 480/485 [02:00<00:01,  3.52it/s]
1.94307594298
failed sanity: left and right line curvature
 99%|█████████▉| 481/485 [02:01<00:01,  3.33it/s]
1.93502861467
failed sanity: left and right line curvature
 99%|█████████▉| 482/485 [02:01<00:00,  3.30it/s]
1.93819449267
failed sanity: left and right line curvature
100%|█████████▉| 483/485 [02:01<00:00,  3.30it/s]
1.93137734308
failed sanity: left and right line curvature
100%|█████████▉| 484/485 [02:02<00:00,  3.29it/s]
1.94850478184
failed sanity: left and right line curvature
100%|██████████| 485/485 [02:02<00:00,  3.25it/s]
1.94850478184
failed sanity: left and right line curvature

[MoviePy] Done.
[MoviePy] >>>> Video ready: ./processed_challenge_video.mp4 

In [ ]: